<template>
  <el-dialog
    :title="'详情'"
    :close-on-click-modal="false"
    :visible.sync="visible">
    <el-form :model="dataForm" :rules="dataRule" ref="dataForm"  label-width="150px">

    <el-form-item label="查询时间" prop="dealtime">
      <el-input v-model="dataForm.dealtime" placeholder="查询时间" :readonly=true>></el-input>
    </el-form-item>
    <el-form-item label="区域代码" prop="region">
      <el-input v-model="dataForm.region" placeholder="区域代码" :readonly=true>></el-input>
    </el-form-item>
    <el-form-item label="发起网点号" prop="obankid">
      <el-input v-model="dataForm.obankid" placeholder="发起网点号" :readonly=true>></el-input>
    </el-form-item>

    <el-form-item label="业务标识码" prop="servicecode">
      <el-input v-model="dataForm.servicecode" placeholder="业务标识码" :readonly=true>></el-input>
    </el-form-item>
    <el-form-item label="不动产登记证明号" prop="realtyno">
      <el-input v-model="dataForm.realtyno" placeholder="不动产登记证明号" :readonly=true>></el-input>
    </el-form-item>
    <el-form-item label="业务件号" prop="serviceno">
      <el-input v-model="dataForm.serviceno" placeholder="业务件号" :readonly=true>></el-input>
    </el-form-item>
    <el-form-item label="登记机构" prop="djjg">
      <el-input v-model="dataForm.djjg" placeholder="登记机构" :readonly=true>></el-input>
    </el-form-item>
    <el-form-item label="登记年" prop="djn">
      <el-input v-model="dataForm.djn" placeholder="登记年" :readonly=true>></el-input>
    </el-form-item>
    <el-form-item label="登记月" prop="djy">
      <el-input v-model="dataForm.djy" placeholder="登记月" :readonly=true>></el-input>
    </el-form-item>
    <el-form-item label="登记日" prop="djr">
      <el-input v-model="dataForm.djr" placeholder="登记日" :readonly=true>></el-input>
    </el-form-item>
    <el-form-item label="年度顺序号" prop="ndsxh">
      <el-input v-model="dataForm.ndsxh" placeholder="年度顺序号" :readonly=true>></el-input>
    </el-form-item>
    <el-form-item label="编号" prop="bh">
      <el-input v-model="dataForm.bh" placeholder="编号" :readonly=true>></el-input>
    </el-form-item>
    <el-form-item label="证明权利或事项" prop="zmql">
      <el-input v-model="dataForm.zmql" placeholder="证明权利或事项" :readonly=true>></el-input>
    </el-form-item>
    <el-form-item label="权利人（申请人）" prop="qlrmc">
      <el-input v-model="dataForm.qlrmc" placeholder="权利人（申请人）" :readonly=true>></el-input>
    </el-form-item>
    <el-form-item label="义务人名称" prop="ywrmc">
      <el-input v-model="dataForm.ywrmc" placeholder="义务人名称" :readonly=true>></el-input>
    </el-form-item>
    <el-form-item label="房屋坐落" prop="zl">
      <el-input v-model="dataForm.zl" placeholder="房屋坐落" :readonly=true>></el-input>
    </el-form-item>
    <el-form-item label="不动产单元号" prop="realtyunitno">
      <el-input v-model="dataForm.realtyunitno" placeholder="不动产单元号" :readonly=true>></el-input>
    </el-form-item>
    <el-form-item label="其他" prop="qt">
      <el-input v-model="dataForm.qt" placeholder="其他" :readonly=true>></el-input>
    </el-form-item>
    <el-form-item label="附记" prop="sf">
      <el-input v-model="dataForm.sf" placeholder="附记" :readonly=true>></el-input>
    </el-form-item>
    <el-form-item label="证书状态" prop="zt">
      <el-input v-model="dataForm.zt" placeholder="证书状态" :readonly=true>></el-input>
    </el-form-item>
    <!-- <el-form-item label="更新时间" prop="dealtime">
      <el-input v-model="dataForm.dealtime" placeholder="更新时间" :readonly=true>></el-input>
    </el-form-item> -->
    <el-form-item label="备注" prop="remark">
      <el-input v-model="dataForm.remark" placeholder="备注" :readonly=true></el-input>
    </el-form-item>
    </el-form>
    <span slot="footer" class="dialog-footer">
      <el-button @click="visible = false">关闭</el-button>

    </span>
  </el-dialog>
</template>

<script>
  export default {
    data () {
      return {
        visible: false,
        dataForm: {
          serialno: 0,
          seqno: '',
          id: '',
          dealtime: '',
          region: '',
          obankid: '',
          authcode: '',
          servicecode: '',
          realtyno: '',
          serviceno: '',
          djjg: '',
          djn: '',
          djy: '',
          djr: '',
          ndsxh: '',
          bh: '',
          zmql: '',
          qlrmc: '',
          ywrmc: '',
          zl: '',
          realtyunitno: '',
          qt: '',
          sf: '',
          zt: '',
          dealtime: '',
          remark: ''
        },
        dataRule: {
        
        }
      }
    },
    methods: {
      init (id) {
        this.dataForm.serialno = id || 0
        this.visible = true
        this.$nextTick(() => {
          this.$refs['dataForm'].resetFields()
          if (this.dataForm.serialno) {
            this.$http({
              url: this.$http.adornUrl(`/bdc/bdccertinfo/info/${this.dataForm.serialno}`),
              method: 'get',
              params: this.$http.adornParams()
            }).then(({data}) => {
              if (data && data.code === 0) {
                this.dataForm.seqno = data.bdcCertinfo.seqno
                this.dataForm.id = data.bdcCertinfo.id
                this.dataForm.qrytime = data.bdcCertinfo.qrytime
                this.dataForm.region = data.bdcCertinfo.region
                this.dataForm.obankid = data.bdcCertinfo.obankid
                this.dataForm.authcode = data.bdcCertinfo.authcode
                this.dataForm.servicecode = data.bdcCertinfo.servicecode
                this.dataForm.realtyno = data.bdcCertinfo.realtyno
                this.dataForm.serviceno = data.bdcCertinfo.serviceno
                this.dataForm.djjg = data.bdcCertinfo.djjg
                this.dataForm.djn = data.bdcCertinfo.djn
                this.dataForm.djy = data.bdcCertinfo.djy
                this.dataForm.djr = data.bdcCertinfo.djr
                this.dataForm.ndsxh = data.bdcCertinfo.ndsxh
                this.dataForm.bh = data.bdcCertinfo.bh
                this.dataForm.zmql = data.bdcCertinfo.zmql
                this.dataForm.qlrmc = data.bdcCertinfo.qlrmc
                this.dataForm.ywrmc = data.bdcCertinfo.ywrmc
                this.dataForm.zl = data.bdcCertinfo.zl
                this.dataForm.realtyunitno = data.bdcCertinfo.realtyunitno
                this.dataForm.qt = data.bdcCertinfo.qt
                this.dataForm.sf = data.bdcCertinfo.sf
                this.dataForm.zt = data.bdcCertinfo.zt
                this.dataForm.dealtime = data.bdcCertinfo.dealtime
                this.dataForm.remark = data.bdcCertinfo.remark
              }
            })
          }
        })
      },
      // 表单提交
      dataFormSubmit () {
        this.$refs['dataForm'].validate((valid) => {
          if (valid) {
            this.$http({
              url: this.$http.adornUrl(`/bdc/bdccertinfo/${!this.dataForm.serialno ? 'save' : 'update'}`),
              method: 'post',
              data: this.$http.adornData({
                'serialno': this.dataForm.serialno || undefined,
                'seqno': this.dataForm.seqno,
                'id': this.dataForm.id,
                'qrytime': this.dataForm.qrytime,
                'region': this.dataForm.region,
                'obankid': this.dataForm.obankid,
                'authcode': this.dataForm.authcode,
                'servicecode': this.dataForm.servicecode,
                'realtyno': this.dataForm.realtyno,
                'serviceno': this.dataForm.serviceno,
                'djjg': this.dataForm.djjg,
                'djn': this.dataForm.djn,
                'djy': this.dataForm.djy,
                'djr': this.dataForm.djr,
                'ndsxh': this.dataForm.ndsxh,
                'bh': this.dataForm.bh,
                'zmql': this.dataForm.zmql,
                'qlrmc': this.dataForm.qlrmc,
                'ywrmc': this.dataForm.ywrmc,
                'zl': this.dataForm.zl,
                'realtyunitno': this.dataForm.realtyunitno,
                'qt': this.dataForm.qt,
                'sf': this.dataForm.sf,
                'zt': this.dataForm.zt,
                'dealtime': this.dataForm.dealtime,
                'remark': this.dataForm.remark
              })
            }).then(({data}) => {
              if (data && data.code === 0) {
                this.$message({
                  message: '操作成功',
                  type: 'success',
                  duration: 1500,
                  onClose: () => {
                    this.visible = false
                    this.$emit('refreshDataList')
                  }
                })
              } else {
                this.$message.error(data.msg)
              }
            })
          }
        })
      }
    }
  }
</script>
